﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MongoServices
{
	internal sealed class ServiceConfigContainer<TService, TModel>
		where TService : MongoServicesService<TModel>
		where TModel : MongoServicesModel
	{
		#region Nested Singleton
		class Nested
		{
			// Explicit static constructor to tell C# compiler
			// not to mark type as beforefieldinit
			static Nested()
			{
			}

			internal static readonly ServiceConfigContainer<TService, TModel> instance = new ServiceConfigContainer<TService, TModel>();
		}

		public static ServiceConfigContainer<TService, TModel> Instance
		{
			get
			{
				return Nested.instance;
			}
		}
		#endregion

		#region BeforeSaveProcesses
		private List<Func<TModel, bool>> _beforeSaveProcesses = new List<Func<TModel, bool>>();
		public List<Func<TModel, bool>> BeforeSaveProcesses
		{
			get { return _beforeSaveProcesses; }
		}
		#endregion

		#region AfterSaveProcesses
		private List<Action<TModel>> _afterSaveProcesses = new List<Action<TModel>>();
		public List<Action<TModel>> AfterSaveProcesses
		{
			get { return _afterSaveProcesses; }
		}
		#endregion
	}
}
